Recently in the basic knowledge, just to fill in C # in the database operation of some technology, today learned executenonquery things, look at their project maintenance project code and online information query, basically understand the use of
ExecuteNonQuery MethodThe ExecuteNonQuery method is primarily used to update data.It is typically used to execute Update,Insert , and Delete statements.The return value of the method has the following meanings:For Update,Insert , and Delete
The example in this article describes the ExecuteNonQuery () return value note point in C #. It has some reference value for C # database program design. Share it for everyone's reference. The specific analysis is as follows:First, when querying a
The ExecuteNonQuery method is primarily used to update data.
It is commonly used to execute update, INSERT, and DELETE statements.
The method returns the value as follows:
For update, INSERT, and DELETE statements, the return value is the number of
C # data query output2012-07-17 17:07
1. Using ExecuteReader () to operate the database2. Using ExecuteNonQuery () to operate the database3. Using ExecuteScalar () to operate the database4. Insert records and update data using DataSet
Sqlcommand. executenonquery MethodExecute a Transact-SQL statement on the connection and return the affected number of rows, which is an int data type.Namespace:System. Data. sqlclientAssembly:System. Data (in system. Data. dllMedium)SyntaxC #public
1, ExecuteNonQuery method.The method performs an update operation, that is, an operation related to a statement such as update, INSERT, delete, in which case the return value is the number of rows affected by the command. For other statements, such
Now let's take a look at the three execute methods of the sqlcommand class: executenonquery, executescalar, and executereader.Executenonquery is used to execute a SQL statement or stored procedure that doesn'tReturn any records. You'll use this
1.SqlCommand. ExecuteNonQuery MethodExecutes Transact-SQL statements on the connection and returns the number of rows affected.Syntax: public override int ExecuteNonQuery () return value:Type: System.Int32Number of rows affectedAttention:① for
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.